(function($) {
	var methods = {
			"init": function(options){
				$.extend( $.mstudpi.global, options );
				return this.each(function(){
					$.mstudpi.create();
				});
			}
		};

	$.mstudpi = {};
	
	$.mstudpi.global = {
			//global variables
	};
	
	$.fn.marcStudent = function( method ) {	    
		// Method calling logic
		if ( methods[method] ) {
			return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
		} else if ( typeof method === 'object' || ! method ) {
			return methods.init.apply( this, arguments );
		} else {
			$.error( 'Method ' +  method + ' does not exist on jQuery.dialogPrompt' );
		}
	};
	
	$.mstudpi.create = function()
	{
		//build out admin menu
		var _appBody = $('#appBody');
		
		_appBody.append(
			$('<ul/>')
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#tabHome')
						.text('Home')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#tabUser')
						.text('My Settings')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#tabAssignments')
						.text('Assignments')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#tabReports')
						.text('Scores/Reports')
					)
				)
			)
			.append($('<div/>')
				.attr('id','tabHome')
			)
			.append($('<div/>')
				.attr('id','tabUser')
			)
			.append($('<div/>')
				.attr('id','tabAssignments')
			)
			.append($('<div/>')
				.attr('id','tabReports')
			);
		
		$.mstudpi.buildHomeTab();
		$.mstudpi.buildUserTab();
		$.mstudpi.buildAssignmentsTab();
		$.mstudpi.buildReportsTab();
		
		$('#appBody').tabs();
	};
	
	$.mstudpi.buildHomeTab = function()
	{
		_containingDiv = $('#tabHome');
		
		var _quickLinksMenu = 
			$('<ul/>')
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Messages')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Events')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('My Grades')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Assignments Due')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Settings')
					)
				);
		
		_quickLinksMenu.menu();
		_containingDiv.append(_quickLinksMenu);
	};
	
	$.mstudpi.buildUserTab = function()
	{
		_containingDiv = $('#tabUser');
		
		var _settingsMenu = 
			$('<ul/>')
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Personal Info')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Aliases')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Notifications')
					)
				);
		
		_settingsMenu.menu();
		_containingDiv.append(_settingsMenu);
	};
	
	$.mstudpi.buildAssignmentsTab = function()
	{
		_containingDiv = $('#tabAssignments');
		
		var _assignmentsMenu = 
			$('<ul/>')
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Due Now')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Submitted')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('E.C. / Make-up')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Expired')
					)
				);
		
		_assignmentsMenu.menu();
		_containingDiv.append(_assignmentsMenu);
	};
	
	$.mstudpi.buildReportsTab = function()
	{
		_containingDiv = $('#tabReports');
		
		var _reportMenu = 
			$('<ul/>')
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('My Grades')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Attendance')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Tardiness')
					)
				)
				.append($('<li/>')
					.append($('<a/>')
						.attr('href','#')
						.text('Alias Usage')
					)
				);
		
		_reportMenu.menu();
		_containingDiv.append(_reportMenu);
	};
})(jQuery);